package com.itheima.demo.demo11;


import java.io.*;
import java.net.Socket;

public class ClientUpLoad {
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("D:\\诗.txt");
        Socket client=new Socket("192.168.35.37",8888);
        OutputStream os = client.getOutputStream();
        int len=0;
        byte[]b=new byte[1024];
        while ((len=fis.read(b))!=-1){
            //将读到的数据发给服务器
            os.write(b,0,len);
        }
        System.out.println("客户端文件发送完毕");
        client.shutdownOutput();

        fis.close();
        client.close();
        os.close();

    }
}
